package com.qumitech.visualnovel.controller.rest;

import com.alibaba.fastjson.JSONObject;
import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.model.common.ResultEnum;
import com.qumitech.visualnovel.model.common.BaseResponse;
import com.qumitech.visualnovel.pubdef.dto.chat.ChatEarnBlockCfgAdminQueryDTO;
import com.qumitech.visualnovel.pubdef.dto.chat.ChatEarnBlockAdminCfgDTO;
import com.qumitech.visualnovel.service.chat.ChatEarnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author zjhu
 * @date 2021/08/14 11:20
 * @description
 */
@RestController
@RequestMapping("/api/chat/earn")
public class ChatEarnController {

    @Autowired
    ChatEarnService chatEarnService;

    @PostMapping("block/cfg")
    public BaseRsp saveChatEarnBlockCfg(@RequestBody ChatEarnBlockAdminCfgDTO cfgDTO){
        chatEarnService.saveChatEarnBlockCfg(cfgDTO);
        return new BaseRsp(ResultEnum.SUCCESS);
    }
    @GetMapping("/block/cfg")
    public BaseRsp listChatEarnBlockCfg(ChatEarnBlockCfgAdminQueryDTO queryDTO){
        return chatEarnService.listChatEarnBlockCfg(queryDTO);
    }

    @DeleteMapping("/block/cfg")
    public BaseRsp rmChatEarnBlockCfg(@RequestParam(value = "config_id") String configId){
        chatEarnService.rmChatEarnBlockCfg(configId);
        return new BaseRsp(ResultEnum.SUCCESS);
    }
}
